import AppSceneUtil from '../../../data/common/appScene';
import PagePromoterUtil, { PagePromoter } from '../../../data/common/pagePromoter';
import SessionUtil, { JxbHttpClient } from '../../../data/session/session';
Page({
    data: {

    },

    onLoad: function (options) {
        getApp().getSaleMode()
        wx.setNavigationBarTitle({
            title: '品牌街'
        })
        SessionUtil.getInstance().then(()=>{
            AppSceneUtil.setPageScene(this)
            PagePromoterUtil.showShareMenu().then()
            this.showBrand(4);
        })
        
    },
    showBrand: function () {
        let client = new JxbHttpClient()
        client.get('AppMaster/BrandInfo/brandList').then(jxbResp=>{
            this.setData({
                brandlist: jxbResp.data
            })
        }).catch(err=>{
            console.log(err)
        })
    },
    showBrandList: function (e) {
        var page = this;
        var info = e.currentTarget.id.split("_");
        var id = info[0];
        var name = info[1];
        console.log(id)
        wx.navigateTo({
            url: '/pages/product/brand/brand?brand_id=' + id,
        })
    },
    onPullDownRefresh: function () {
        wx.stopPullDownRefresh()
    },
    onShareAppMessage: function(){
        let session = SessionUtil.getInstanceSync(),
        resp = (new PagePromoter( this.route, {}))
        .setShareTitle(session.getTheSellingServerSync().showName)
        .buildShareInfo() 
        console.log(resp, '分享内容')
        return resp
    }
})